<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>

<style>
    .Completed,.status_2{color: #c00;}
    .Refunded,.status_1{color: #f60;}
    .Pending{color: #36c;}
    .Unclaimed,.status_3{color: #666;}
</style>
<div class="admin_nrtop">
    <div class="ad_search">
        <form action="/admini/paypal/risk/"  method="get" style="margin:0px" id="form1">
        <div class="search">
            <div class="soubox">
                <input type="text" id="quick" name="quick" value="<?php echo $this->quick?$this->quick:"";?>" placeholder="输入交易号/Paypal帐号"/>
                <input type="hidden" id="dateinbegin" name="dateinbegin" value="<?php echo $this->dateinbegin?$this->dateinbegin:"";?>"/>
                <input type="hidden" id="dateinend" name="dateinend" value="<?php echo $this->dateinend?$this->dateinend:"";?>" />
            </div>
            <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
        </div>

        <div class="timebox">
            <div class="ad_time">
                <div class="timezdy">
                    <div class="timeselect2">
                        <span>选择时间</span>
                    </div>
                </div>
                <div class="timefw">
                    <div class="time">
                        <!--点击后悬停样式为：<div class="timeselect t_on">-->
                        <div class="timeselect"  id="stime">
                            <span id="stimeval"><?php echo $this->starttime?$this->starttime:date("Y-m-d",mktime(0,0,0,date("m"),date("d")-1,date("Y")));?></span><i></i>
                        </div>
                        <div class="timeslelctbox">
                            <!---时间插件放此DIV-->
                        </div>
                    </div>
                    <div class="timezhi">
                        <span>至</span>
                    </div>
                    <div class="time" >
                        <div class="timeselect" id="etime">
                            <span id="etimeval"><?php echo $this->endtime?$this->endtime:date("Y-m-d");?></span><i></i>
                        </div>
                        <div class="timeslelctbox">
                            <!---时间插件放此DIV-->
                        </div>
                    </div>
                </div>
            </div>
            <div class="timeok">
                <a href="javascript:$('#form1').submit();">确定</a>
            </div>
        </div>
        </form>
    </div>
</div>
<div  class="biaoge">
	<div class="biaotbody">
            	<table>
                    <tr>
                    	<th class="li205">
                            <div class="lijz"><input name="checkall" type="checkbox" id="checkall" value=""></div>
                        </th>
                    	<th class="li9">
                            <div class="lileft">Paypal帐号</div>
                        </th>
                    	<th class="li9">
                            <div class="lijz">交易号</div>
                        </th>
                    	<th class="li9">
                            <div class="lijz">金额</div>
                        </th>
                    	<th class="li10">
                            <div class="lijz">悠奇用户ID</div>
                        </th>
                        <th class="li7">
                            <div class="lijz">风险原因</div>
                        </th>
                    	<th class="li7">
                            <div class="lijz">交易时间</div>
                        </th> 
                        <th class="li7">
                            <div class="lijz">备注</div>
                        </th> 
                        <th class="li7">
                            <div class="lijz">账户备注</div>
                        </th> 
                        <th class="li7">
                            <div class="lijz">操作</div>
                        </th>                   	
                    </tr>
                </table>
            </div>
            <div class="table">
                <table>
                <?php 
                    if( $this->items){
                    foreach ($this->items as $key => $item) {?>
                    	<tr height='50px'>
                            <td class="li205"><div class="lijz"><input type="checkbox" id="chk<?php echo $item->id; ?>" name="ID" /></div></td>
                            <td class="li9">
                                <div class="lileft"><?php echo $item->Payer_email;?></div>
                            </td>
                            <td class="li9"><div class="lijz"><?php echo $item->Txn_id;?></div></td>
                            <td class="li9"><div class="lijz"><?php echo $item->Amount;?></div></td>
                            <td class="li10"><div class="lijz"><a style="text-decoration:underline; color:blue" target="_blank"  href="/admini/manageuser/userdetail/id/<?php echo $item->Uuch_user_id;?>"><?php echo $item->Uuch_user_id;?></a></div></td>
                            <td class="li7"><div class="lijz"><?php echo $item->Reason;?></div></td>
                            <td class="li7"><div class="lijz"><?php echo $item->Created_at;?></div></td>
                            <td class="li7"><div class="lijz"><?php echo $item->Remark; ?></div></td>
                            <td class="li7"><div class="lijz">
                            <?php $user_info = Application_Model_User::getByUserId($item->Uuch_user_id); ?>
							<textarea cols="20" rows="" name="<?php echo $item->Uuch_user_id;?>" style="padding:2px; border:none;" class="palpay_bz"><?php echo $user_info->paypal; ?></textarea>
                            </div></td>
                            <td class="li7">
                            	<div class="lixlnav">
                                    <a class="xlnavxq" href="javascript:void(0)" >默认</a>
                                    <div class="xlnavlistbox" >
                                        <a class="xlnavsj" href="javascript:void(0)"><i></i></a>
                                        <div class="xlnavlist" style="display:none;width: 110px;">
                                            <ul>
                                            	<li><a href="javascript:void(0);" class='setStatus' name='pass' i='<?php echo $item->Id;?>'>设为本次通过</a></li>                                                
                                                <li><a href="javascript:void(0);" class='setStatus' name='black' i='<?php echo $item->Id;?>'>设为黑名单</a></li>
                                                <li><a href="javascript:void(0);" class='setStatus' name='white' i='<?php echo $item->Id;?>'>设为悠奇认证</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </td>                                               
                        </tr>
                <?php } } else { echo '<div class="tablebox">暂时无数据</div>';}?>
                </table>
            </div>
    </div>
<div class="toolbar">
<?php
echo $this->partial('paging.phtml', array("pages" => $this->data,"pamas"=>"quick=$this->quick&dateinbegin=$this->dateinbegin&dateinend=$this->dateinend"));        
?>
</div>    
<script>
    $('.soubox label').click(function(){
            $(this).parent().find('input').focus();
    });
    $(".timezdy").click(function(){
        $(".timezdy .timeselect2").attr("class","timeselect2 timeon");
        $(".timeslelct_xl").show();
    });
    $(".timezdy").mouseleave(function(){
       $(".timeselect2").attr("class","timeselect2");
       $(".timeslelct_xl").hide();
    });
    $("#stime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'stimeval',vel:'dateinbegin',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
        }});
    });
    $("#etime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'etimeval',vel:'dateinend',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
        }});
    });
    $(".lixiala").click(function(){
        $(".lixiala").attr("class","lixiala");
        $(".lixiala").next("div").hide();
    
        $(this).attr("class","lixiala bton");
        $(this).next("div").show();
    });

    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".biaoxiala").length == 0){
            $(".lixiala").attr("class","lixiala");
            $(".lixiala").next("div").hide();
        }
        if(target.closest("#stime").length == 0){
            $("#stime").attr("class","timeselect");
        }
        if(target.closest("#etime").length == 0){
            $("#etime").attr("class","timeselect");
        }
    });
    $(".xlnavsj").live("mousemove",function(){
        $(this).next("div").show();
    });
    $(".lixlnav").mouseleave(function(){
        $(".xlnavsj").next("div").hide();
    });
    function setProperty(property,value)
    {
        $("#form1 #"+property).val(value);
        $("#form1").submit();
    }
    function removeset(property)
    {
        $("#form1 #"+property).val("");
        $("#form1").submit();
    }
	$(".setStatus").click(function(){
	   var status = $(this).attr("name");
       var statusName = $(this).text();
       var id = $(this).attr("i");
       if(confirm("您确定把该帐号"+statusName,"提示信息")){   
            $.ajax({
                 type: 'POST',
                 url: '/admini/paypal/setstatus/id/'+id+"/status/"+status,
                 success: function(data) {
                        if(data == 1){
                            alert("设置成功！");
                        }else{
                            alert("出现未知错误！");
                        }
                        location.reload();
                    }
               });
       }
    });
	
//	$(document).ready(function(){
//	  $("input").focus(function(){
//		$("input").css("background-color","#FFFFCC");
//	  });
//	  $("input").blur(function(){
//		$("input").css("background-color","#000");
//	  });
//	});	
	
	$(".palpay_bz").blur(function(){
        var remark = $(this).val(), 
		id = $(this).attr("name");
		//alert(remark);alert(id);
		$.ajax({
		   type: 'POST',
		   url: '/admini/paypal/upremark/id/'+id + '/remark/'+remark,
		   success: function(data) {
			   if(data==1){ 
			   	alert('修改成功！');
				location.reload();
			   }
			}
		 });
    });
	
	$("a.uuch_user").click(function(){
        var userid = $(this).text(); 
		$.ajax({
		   type: 'POST',
		   url: '/admini/paypal/getpaypallist/userid/'+userid,
		   success: function(data) {
				  alert(data);
			}
		 });
		 return false;
    });
	
	
	$("a.paypal").click(function(){
        var paypal = $(this).text(); 
		$.ajax({
		   type: 'POST',
		   url: '/admini/paypal/getuserlist/paypal/'+paypal,
		   success: function(data) {
				  alert(data);
			}
		 });
		 return false;
    });
</script>
